<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
pageContext.setAttribute("basePath",basePath);
%>
<!DOCTYPE html>
<html lang="zh-cn">
	<head>
		<meta charset="UTF-8">
		<title>开始考试</title>
		<meta name="viewport" content="width=device-width, initial-scale=1.0">

		<link rel="stylesheet" type="text/css" href="${basePath}resources/bootstrap/css/bootstrap-responsive.css">
		<link rel="stylesheet" type="text/css" href="${basePath}resources/bootstrap/css/bootstrap.css">
		<link rel="stylesheet" type="text/css" href="${basePath}resources/css/basic.css">
		<link rel="stylesheet" type="text/css" href="${basePath}resources/css/login.css">
		<link rel="stylesheet" type="text/css" href="${basePath}resources/css/start_exam.css">
		
		<script type="text/javascript" src="${basePath}resources/js/common/base.js"></script>
		<script type="text/javascript" src="${basePath}resources/js/common/jquery-3.2.1.min.js"></script>
		<script type="text/javascript" src="${basePath}resources/bootstrap/js/bootstrap.js"></script>
		<script type="text/javascript" src="${basePath}resources/js/common/jquery-3.2.1.min.js"></script>
		<script type="text/javascript" src="${basePath}resources/angular-1.3.0/angular.min.js"></script>
		<script type="text/javascript" src="${basePath}resources/js/start_exam.js?t=20170604"></script>
	</head>
	<body ng-app="myApp" ng-controller="startExamController">
		<div id="header">
			<%@ include file="common/header.jsp" %>
			<h1>开始考试</h1>
		</div>
		<div id="container">
			<form onsubmit="return false;" name="loginForm" novalidate>
				<div>
					<div class="panel panel-default questionItem" ng-repeat="x in questions">
						<div class="panel-heading">
							<h3 class="panel-title">{{$index+1}}. &nbsp; {{x.questionContent}}</h3>
							<h3 ng-if="x.imgUrl">
								<img style="width: 80px;height: 80px;" src="{{x.imgUrl}}" alt="图片">
							</h3>
						</div>
						<div class="panel-body">
				      		<div>
								<input type="radio" name="selection" ng-change="judge(x.questionId,x.questionAnswer,x.userAnswer)" ng-model="x.userAnswer" value="A"> &nbsp; A. &nbsp; {{x.selectionA}}
							</div>
							<div>
								<input type="radio" name="selection" ng-change="judge(x.questionId,x.questionAnswer,x.userAnswer)" ng-model="x.userAnswer" value="B"> &nbsp; B. &nbsp; {{x.selectionB}}
							</div>
							<div>
								<input type="radio" name="selection" ng-change="judge(x.questionId,x.questionAnswer,x.userAnswer)" ng-model="x.userAnswer" value="C"> &nbsp; C. &nbsp; {{x.selectionC}}
							</div>
							<div>
								<input type="radio" name="selection" ng-change="judge(x.questionId,x.questionAnswer,x.userAnswer)" ng-model="x.userAnswer" value="D"> &nbsp; D. &nbsp; {{x.selectionD}}
							</div>
				    	</div>
						<div>
							<div ng-if="x.userAnswer">
								您的答案是: &nbsp; {{x.userAnswer}}
							</div>
							<!--
							<div ng-if="x.userAnswer == x.questionAnswer && x.userAnswer">
								<div style="color: green;">
									您答对了
								</div>
							</div>
							<div ng-if="x.userAnswer != x.questionAnswer && x.userAnswer">
								<div style="color: red;">
									您答错了
								</div>
							</div>
							-->
						</div>
					</div>
				</div>
				<div>
					<!--
					<div>
						<strong>您共答对了{{rightCount}}题</strong>
					</div>
					-->
				</div>
				<div>
					<button class="btn btn-primary" ng-click="finishPaper()">交卷</button>
				</div>
			</form>

		</div>
		<div id="footer">
			<%@ include file="common/footer.jsp" %>
		</div>
	</body>
</html>